package com.gitee.feizns.web.ex.impl;

import com.gitee.feizns.web.domain.result.Ret;
import com.gitee.feizns.web.ex.CustomizeExceptionHandler;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.HttpMediaTypeNotSupportedException;

/**
 * @author feizns
 * @since 2019/7/24
 */
public class HttpMediaTypeNotSupportedExceptionHandler implements CustomizeExceptionHandler<HttpMediaTypeNotSupportedException, Object> {

    @Override
    public ResponseEntity<Ret<Object>> handle(HttpMediaTypeNotSupportedException e) {
        return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(Ret.err(HttpStatus.BAD_REQUEST.value(), e.getMessage()));
    }

}
